<?php


namespace app\shop\model;


use think\Model;

class GoodsAttrModel extends Model
{
    protected $table = 'dp_goods_attr';
    protected $pk = 'attr_id';
    protected $field = true;

    public static function getRes($goods_id=0,$attr_id)
    {
        return self::where('attr_id',$attr_id)->where('goods_id',$goods_id)->select();
    }

    public static function getRes2($goods_id=0)
    {
        return self::where('goods_id',$goods_id)->select();
    }

    public static function savePrice($goods_attr_id=0,$attr_price=0)
    {
        return self::where('goods_attr_id',$goods_attr_id)->update(['attr_price'=>$attr_price]);
    }

    public static function del($goods_id=0)
    {
        return SpecItemModel::where('goods_id',$goods_id)->delete();
    }

    public static function delGoodsAttrId($goods_attr_id=0)
    {
        return self::where('goods_attr_id',$goods_attr_id)->delete();
    }


}